// <editor-fold defaultstate="collapsed" desc="GNU GPLv3 Header">
/*
 * File:   main.c
 *
 * Copyright (C) 2013 Robert Antoni Buj Gelonch <rbuj@uoc.edu>
 * Copyright (C) 2013 David Megias Jimenez <dmegias@uoc.edu>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Created on September 5, 2013, 12:06 PM
 */
// </editor-fold>

#include <stdio.h>
#include <stdlib.h>
#include "WaveDataPCMByte.h"

/*
 * 
 */
int main(int argc, char** argv) {
    if (argc != 3) {
        fprintf(stderr, "Usage: %s input.wav output.wav\n", argv[0]);
        return (EXIT_FAILURE);
    }
    FILE *file;
    file = fopen(argv[1], "rb");
    if (!file) {
        return (EXIT_FAILURE);
    }
    WaveDataPCMByte* waveData = readWaveDataPCMByte(file);
    fclose(file);
    file = fopen(argv[2], "wb");
    if (!file) {
        return (EXIT_FAILURE);
    }
    writeWaveDataPCMByte(waveData, file);
    fclose(file);
    freeWaveDataPCMByte(waveData);
    return (EXIT_SUCCESS);
}

